let localServer = '192.168.3.63'
let commonServerApi = 'http://192.168.1.11:10080'
let leaderServerApi = 'http://192.168.1.11:10086'
let reportCeszServerApi = 'http://192.168.6.12:8081'
// let commonServerApi = 'http://gamma.uhomecp.com'
// let leaderServerApi = 'http://gamma.uhomecp.com'
let proxyConfig = {
  '/uhomecp-portal': commonServerApi,
  '/report-led-api': leaderServerApi,
  '/uhomecp-sso': commonServerApi,
  '/common-api': commonServerApi,
  '/uhome-portal': commonServerApi,
  '/report-cesz': reportCeszServerApi
}
const proxy = {}
for (let key in proxyConfig) {
  proxy[key] = {
    target: proxyConfig[key],
    changeOrigin: true,
    cookieDomainRewrite: {
      '*': localServer // 把相应的 cookie 域都设置成 localhost
    },
    withCredentials: true
  }
}
const path = require('path')
module.exports = {
  css: {
    loaderOptions: {
      sass: {
        data: `@import "@/assets/scss/initialization.scss";`
      }
    }
  },
  chainWebpack: config => {
    const fileRule = config.module.rule('file')
    fileRule.uses.clear()
    fileRule
      .test(/\.swf$/)
      .exclude.add(path.resolve(__dirname, './src/icons'))
      .end()
      .use('file-loader')
      .loader('file-loader')
  },
  devServer: {
    proxy
  },
  // 打包后文件路径
  // 打包文件名
  outputDir: 'leader-view-sany',
  assetsDir: 'static',
  indexPath: 'index.html',
  publicPath: '/h5/leader-view-sany/'
}
